/*
 * uiapp.cpp
 *
 *  Created on: 2011-5-23
 *      Author: chenl
 */

#include "uiapp.h"
#include "psapp.h"
#include "../gui/ncurses/ncurses_drawer.h"

CUIApp::CUIApp() : logEngine(GET_UITHREADLOG_INSTANCE())
{

}

CUIApp::~CUIApp()
{

}

int32_t CUIApp::Initialize()
{
	pDrawer_ = new CNcursesDrawer();
	if (NULL == pDrawer_)
		return E_PS_INIT_DRAWER_FAIL;
	int32_t ret = pDrawer_->Initialize();
	assert(0 <= ret);
	return S_OK;
}

int32_t CUIApp::Uninitialize()
{
	delete pDrawer_;
	return S_OK;
}

void CUIApp::DoUpdate()
{
	assert(NULL != pDrawer_);
	pDrawer_->Update(&GET_PROCESSMGT_INSTANCE());
	SetUpdated();
}

void CUIApp::SetUpdated()
{
	CPSApp& psApp = GET_PSAPP_INSTANCE();
	psApp.SetUpdated();
}

bool CUIApp::IsUpdated()
{
	CPSApp& psApp = GET_PSAPP_INSTANCE();
	return psApp.IsUpdated();
}
